package top.lemcoo.exam;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.test.context.junit4.SpringRunner;
import top.lemcoo.exam.modules.system.domain.SysRole;
import top.lemcoo.exam.modules.system.domain.SysUser;
import top.lemcoo.exam.modules.system.mapper.SysRoleMapper;
import top.lemcoo.exam.modules.system.mapper.SysUserMapper;

import java.util.List;

/**
 * @author zhaowx
 * @Description
 * @date 2021/8/4
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class test {

    @Autowired
    SysUserMapper userMapper;
    @Autowired
    SysRoleMapper roleMapper;
    @Autowired
    BCryptPasswordEncoder encoder;

    @Test
    public void test(){
        QueryWrapper<SysUser> qw = new QueryWrapper<>();
        qw.lambda().eq(SysUser::getUserName, "admin");
        //SysUser sysUser = userMapper.selectList(null);
        List<SysUser> sysUsers = userMapper.selectList(null);
        System.out.println(sysUsers);
    }
    @Test
    public void test2(){
        SysRole sysRole = roleMapper.selectRoleById(1L);
        System.out.println(sysRole);
    }
    @Test
    public void test3(){
        System.out.println(encoder.encode("admin"));
    }
}
